<?php
declare (strict_types = 1);

namespace app\controller;

use app\model\Student;
use app\service\StudentService;
use think\App;
use think\Request;
use app\BaseController;

class StudentController extends BaseController
{
    private $service;

    public function __construct(App $app)
    {

        parent::__construct($app);
        $this->service = new StudentService();
    }

    public function studentInformation(){

        return $this->service->getInformation();
    }

    public function deleteStudent(Student $id){
        $this->service->deleteUser($id->id);
        return $this->returnJson();
    }

    public function disable(Student $id){
        $isAdmin = $this->request->param('isAdmin');
        $this->service->disableStudent($id->id,$isAdmin);
        return $this->returnJson();
    }

}
